Evolutionary lottery of skull and beak morphology


Beak and skull shapes in birds of prey (“raptors”) are strongly coupled and largely controlled by size.

gif provided by the awesome Jen Bright @MorphobeakGeek!

In this exercise we will use a github repo to collaboratively collate and simulate evolutionary trajectories for each participants’ species body size using a simple brownian motion evolutionary model. This assumes evolutionary steps to progress comletely at random. You could say:

it’s a bit of lottery!


Each participant has created and contributed a file specifying the parameters required to simulate and plot their species evolutionary trajectory. We’ve collect all participants’ files in the master repo. Next we need to simulate species trajectories plot them up.

Participants will then get to see the skull and beak shape corresponding to their species relative body size!


setup

First we load the required packages and create some objects to compile data on trait evolution for each species.

require(dplyr)
require(ggplot2)
require(plotly)
set.seed(1)

t <- 0:100  # generate time vector
dt <- NULL # generate object to compile time-series data
cols <- NULL # generate object to compile trendline colours

Simulate trait evolution, iterate over all species files in params/ folder

We’ll use the parameters supplied in your scripts to generate brownian trait evolution trendline for each species.

spp.files <- dir("params/")[dir("params/") != "params_tmpl.R"]

for(spp in spp.files){
  # source parameters for each species
  source(file.path("params", spp))
  
  # generate trait evolution time-series and compile plotting data
  dt <-  rbind(dt, data.frame(t, 
                              trait = c(0, rnorm(n = length(t) - 1, sd = sqrt(sig2)) %>% cumsum()),
                              species = species.name))
  cols <- c(cols, color)
}

Plot trait evolution timeseries

Use the data generated to plot all species.

p <- ggplot(data = dt, aes(x = t, y = trait, group = species, colour = species)) + 
  geom_line() + 
  scale_colour_manual(values = cols) 
  
  ggplotly(p)



Skulls! find the skull associated with your species:


Skulls are organised from largest to smallest. The largest skulls are vulture-like, (e.g. no. 50, the Andean condor Vultur gryphus) and the smallest are falconet-like, (e.g. no. 1 Collared falconet Microhierax caerulescens)

No: 43 Seans_bird

No: 36 Aliya_Penguin

No: 30 Dans_Chicken

No: 26 Nina_penguin

No: 26 Carls Albatross

No: 25 terror finch

No: 25 Big horn extincta

No: 24 Ablah

No: 22 Edwins_Parrot

No: 21 Andy’s penguin

No: 20 Farah_eagle

No: 15 Sairas_penguin

No: 2 Neils penguin

Session Info

sessioninfo::session_info()
## ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
##  setting  value
##  version  R version 4.2.1 (2022-06-23)
##  os       Arch Linux
##  system   x86_64, linux-gnu
##  ui       X11
##  language (EN)
##  collate  en_GB.utf8
##  ctype    en_GB.utf8
##  tz       Europe/London
##  date     2022-10-31
##  pandoc   2.19.2 @ /usr/bin/ (via rmarkdown)
## 
## ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
##  package     * version date (UTC) lib source
##  assertthat    0.2.1   2019-03-21 [2] CRAN (R 4.2.0)
##  bslib         0.4.0   2022-07-16 [2] CRAN (R 4.2.1)
##  cachem        1.0.6   2021-08-19 [2] CRAN (R 4.2.0)
##  cli           3.4.1   2022-09-23 [2] CRAN (R 4.2.1)
##  colorspace    2.0-3   2022-02-21 [2] CRAN (R 4.2.0)
##  crosstalk     1.2.0   2021-11-04 [2] CRAN (R 4.2.0)
##  data.table    1.14.4  2022-10-17 [2] CRAN (R 4.2.1)
##  DBI           1.1.3   2022-06-18 [2] CRAN (R 4.2.0)
##  digest        0.6.30  2022-10-18 [2] CRAN (R 4.2.1)
##  dplyr       * 1.0.10  2022-09-01 [2] CRAN (R 4.2.1)
##  evaluate      0.17    2022-10-07 [2] CRAN (R 4.2.1)
##  fansi         1.0.3   2022-03-24 [2] CRAN (R 4.2.0)
##  fastmap       1.1.0   2021-01-25 [2] CRAN (R 4.2.0)
##  generics      0.1.3   2022-07-05 [2] CRAN (R 4.2.1)
##  ggplot2     * 3.3.6   2022-05-03 [2] CRAN (R 4.2.0)
##  glue          1.6.2   2022-02-24 [2] CRAN (R 4.2.0)
##  gtable        0.3.1   2022-09-01 [2] CRAN (R 4.2.1)
##  htmltools     0.5.3   2022-07-18 [2] CRAN (R 4.2.1)
##  htmlwidgets   1.5.4   2021-09-08 [2] CRAN (R 4.2.0)
##  httr          1.4.4   2022-08-17 [2] CRAN (R 4.2.1)
##  jquerylib     0.1.4   2021-04-26 [2] CRAN (R 4.2.0)
##  jsonlite      1.8.3   2022-10-21 [2] CRAN (R 4.2.1)
##  knitr         1.40    2022-08-24 [2] CRAN (R 4.2.1)
##  labeling      0.4.2   2020-10-20 [2] CRAN (R 4.2.0)
##  lazyeval      0.2.2   2019-03-15 [2] CRAN (R 4.2.0)
##  lifecycle     1.0.3   2022-10-07 [2] CRAN (R 4.2.1)
##  magrittr      2.0.3   2022-03-30 [2] CRAN (R 4.2.0)
##  munsell       0.5.0   2018-06-12 [2] CRAN (R 4.2.0)
##  pillar        1.8.1   2022-08-19 [2] CRAN (R 4.2.1)
##  pkgconfig     2.0.3   2019-09-22 [2] CRAN (R 4.2.0)
##  plotly      * 4.10.0  2021-10-09 [2] CRAN (R 4.2.0)
##  purrr         0.3.5   2022-10-06 [2] CRAN (R 4.2.1)
##  R6            2.5.1   2021-08-19 [2] CRAN (R 4.2.0)
##  rlang         1.0.6   2022-09-24 [2] CRAN (R 4.2.1)
##  rmarkdown     2.17    2022-10-07 [2] CRAN (R 4.2.1)
##  sass          0.4.2   2022-07-16 [2] CRAN (R 4.2.1)
##  scales        1.2.1   2022-08-20 [2] CRAN (R 4.2.1)
##  sessioninfo   1.2.2   2021-12-06 [2] CRAN (R 4.2.0)
##  stringi       1.7.8   2022-07-11 [2] CRAN (R 4.2.1)
##  stringr       1.4.1   2022-08-20 [2] CRAN (R 4.2.1)
##  tibble        3.1.8   2022-07-22 [2] CRAN (R 4.2.1)
##  tidyr         1.2.1   2022-09-08 [2] CRAN (R 4.2.1)
##  tidyselect    1.2.0   2022-10-10 [2] CRAN (R 4.2.1)
##  utf8          1.2.2   2021-07-24 [2] CRAN (R 4.2.0)
##  vctrs         0.5.0   2022-10-22 [2] CRAN (R 4.2.1)
##  viridisLite   0.4.1   2022-08-22 [2] CRAN (R 4.2.1)
##  withr         2.5.0   2022-03-03 [2] CRAN (R 4.2.0)
##  xfun          0.34    2022-10-18 [2] CRAN (R 4.2.1)
##  yaml          2.3.6   2022-10-18 [2] CRAN (R 4.2.1)
## 
##  [1] /home/neil/R/x86_64-pc-linux-gnu-library/4.2
##  [2] /usr/lib/R/library
## 
## ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

This projects uses renv for dependency management.